#ifndef _GLOBAL_FILE
#define _GLOBAL_FILE

#include "gameState.h"

#define WEIGHT_FILE "WEIGHTS"
#define MPC_FILE    "MPC_PARAM"
#define MPC_DATA    "MPC_DATA"
#define NUM_STAGES  92

#ifndef INFINITY
#define INFINITY 100000000
#endif

#define swap(a, b, temp)    (temp = a, a = b, b = temp)

/* masks used during move generation */
extern BitBoard DIRECTION_MASK[MAX_DIRECTION];

/* masks used for disc features
   15 types of discs are
   1  2  3  4  5
      6  7  8  9
         10 11 12
            13 14
               15                       */
extern BitBoard DISC_FEATURE[15];

/* the color agent is playing */
extern BoardState AGENT_PLAYER;

/* masks used to get the lower n bits and higher n bits of numbers */
extern U64 BitMaskLow[50], BitMaskHigh[50];

/* bit lookup table */
static const char LogTable256[256] = 
{
#define LT(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n
    -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
    LT(4), LT(5), LT(5), LT(6), LT(6), LT(6), LT(6),
    LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7)
};


/* initialise the bit masks */
void initialiseMasks();

/* return absolute value of a */
double absolute(double a);

/* determine convergence if the past N (defined constant) errors are all within
   a % threshold of the average error                                         */
bool Converged(double error, double THRESHOLD);

#endif
